package com.zf.shuashua.ui.home;

import android.content.Context;

import com.lxj.xpopup.core.CenterPopupView;
import com.zf.shuashua.R;
import com.zf.shuashua.utils.ToastUtil;

public class InterestPopup extends CenterPopupView {

    private OnInterestListener mListener;

    public InterestPopup(Context context, OnInterestListener onInterestListener) {
        super(context);
        this.mListener = onInterestListener;
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.interest_popup;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        findViewById(R.id.interest_quality).setOnClickListener(v -> {
            dismissWithTip(v.getContext());
        });
        findViewById(R.id.interest_author).setOnClickListener(v -> {
            dismissWithTip(v.getContext());
        });
        findViewById(R.id.interest_similar).setOnClickListener(v -> {
            dismissWithTip(v.getContext());
        });
        findViewById(R.id.interest_discomfort).setOnClickListener(v -> {
            dismissWithTip(v.getContext());
        });
    }

    private void dismissWithTip(Context context){
        ToastUtil.showInCenter(context, "已为你减少该类型的作品");
        if(mListener != null){
            mListener.onInterest();
        }
        dismiss();
    }

}